﻿<%@ Page Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="ViewContractorByRole.aspx.cs"
    Inherits="ContractManagementSystem.ViewContractorByRole" Title="Untitled Page" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PanelContent" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>

            <script type="text/javascript">
            function confirmPost()
            {
        	    var agree = confirm("Are you sure you want to delete?");
        	    if (agree)
        		    return true;
        	    else
        		    return false;
            }
            </script>

            <asp:Panel runat="server" ID="ListContractorPanel">
                <h2 class="divTitle">
                    List All Contractor</h2>
                <div class="divSearch">
                    <table style="width: 100%">
                        <tr>
                            <td>
                                FullName:
                                <asp:TextBox runat="server" ID="FullNameTextBoxSearch" AutoPostBack="True" OnTextChanged="FullNameTextBoxTextChanged"></asp:TextBox>
                                <asp:Button ID="Button1" runat="server" Text="Search" />
                            </td>
                        </tr>
                    </table>
                </div>
                <asp:ListView runat="server" ItemPlaceholderID="NewItem" ID="ViewAllContractListView"
                    OnItemDeleting="ViewAllContractListView_OnItemDeleting" OnItemEditing="ViewAllContractListView_OnItemEditing">
                    <LayoutTemplate>
                        <table id="table">
                            <tr>
                                <th>
                                    <asp:LinkButton runat="server" ToolTip="Sort" ID="LinkButton7">
                                        FullName
                                    </asp:LinkButton>
                                    <asp:Image runat="server" ID="SortFullName" ImageUrl="App_Themes/Admin/Image/down.png" />
                                </th>
                                <th>
                                    <asp:LinkButton runat="server" ToolTip="Sort" ID="LinkButton98">
                                        BirthDate
                                    </asp:LinkButton>
                                    <asp:Image runat="server" ID="Image1" ImageUrl="App_Themes/Admin/Image/down.png" />
                                </th>
                                <th>
                                    <asp:LinkButton runat="server" ToolTip="Sort" ID="LinkButton2">
                                    Gender
                                    </asp:LinkButton>
                                    <asp:Image runat="server" ID="Image6" ImageUrl="App_Themes/Admin/Image/down.png" />
                                </th>
                                <th>
                                    <asp:LinkButton runat="server" ToolTip="Sort" ID="LinkButton10">
                                        Email
                                    </asp:LinkButton>
                                    <asp:Image runat="server" ID="Image2" ImageUrl="App_Themes/Admin/Image/down.png" />
                                </th>
                                <th>
                                    <asp:LinkButton runat="server" ToolTip="Sort" ID="LinkButton11">
                                        Address
                                    </asp:LinkButton>
                                    <asp:Image runat="server" ID="Image3" ImageUrl="App_Themes/Admin/Image/down.png" />
                                </th>
                                <th>
                                    <asp:LinkButton runat="server" ToolTip="Sort" ID="LinkButton12">
                                        PhoneNumber
                                    </asp:LinkButton>
                                    <asp:Image runat="server" ID="Image4" ImageUrl="App_Themes/Admin/Image/down.png" />
                                </th>
                                <th>
                                    <asp:LinkButton runat="server" ToolTip="Sort" ID="LinkButton13">
                                        Branch
                                    </asp:LinkButton>
                                    <asp:Image runat="server" ID="Image5" ImageUrl="App_Themes/Admin/Image/down.png" />
                                </th>
                                <th>
                                    <asp:LinkButton runat="server" ToolTip="Sort" ID="LinkButton1">
                                        Action
                                    </asp:LinkButton>
                                </th>
                            </tr>
                            <tr>
                                <asp:PlaceHolder runat="server" ID="NewItem"></asp:PlaceHolder>
                            </tr>
                        </table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr class="odd">
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="ContractorId" Visible="False" Text='<%#Eval("ContractorId") %>'></asp:Label>
                                <asp:Label runat="server" ID="FullName" Text='<%#Eval("FullName") %>'></asp:Label>
                            </td>
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="BirthDate" Text='<%#Eval("BirthDate","{0:d}") %>'></asp:Label>
                            </td>
                            <td style="text-align: left">
                                <asp:Label runat="server" ID="Gender" Text='<%#Eval("Gender") %>'></asp:Label>
                            </td>
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="Email" Text='<%#Eval("Email") %>'></asp:Label>
                            </td>
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="Address" Text='<%#Eval("Address")%>'></asp:Label>
                            </td>
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="PhoneNumber1" Text='<%#Eval("PhoneNumber1")%>'></asp:Label>
                                <asp:Label runat="server" ID="PhoneNumber2" Visible="False" Text='<%#Eval("PhoneNumber2")%>'></asp:Label>
                            </td>
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="Branch" Text='<%#Eval("Branch")%>'></asp:Label>
                            </td>
                            <td>
                                <div style="text-align: center">
                                    <asp:LinkButton runat="server" ToolTip="Edit" ID="editLinkButton" CommandName="Edit"
                                        CssClass="edit" OnCommand="EditLinkButton_OnCommand" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"STT" )%>'></asp:LinkButton>
                                    <asp:LinkButton runat="server" ToolTip="Delete" ID="deleteButton" CommandName="Delete"
                                        CssClass="delete" OnClientClick="return confirmPost()" OnCommand="DeleteButton_OnCommand"
                                        CommandArgument='<%# DataBinder.Eval(Container.DataItem,"ContractorId") %>'></asp:LinkButton>
                                </div>
                            </td>
                        </tr>
                    </ItemTemplate>
                    <AlternatingItemTemplate>
                        <tr class="alt">
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="ContractorId" Visible="False" Text='<%#Eval("ContractorId") %>'></asp:Label>
                                <asp:Label runat="server" ID="FullName" Text='<%#Eval("FullName") %>'></asp:Label>
                            </td>
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="BirthDate" Text='<%#Eval("BirthDate","{0:d}") %>'></asp:Label>
                            </td>
                            <td style="text-align: left">
                                <asp:Label runat="server" ID="Gender" Text='<%#Eval("Gender") %>'></asp:Label>
                            </td>
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="Email" Text='<%#Eval("Email") %>'></asp:Label>
                            </td>
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="Address" Text='<%#Eval("Address")%>'></asp:Label>
                            </td>
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="PhoneNumber1" Text='<%#Eval("PhoneNumber1")%>'></asp:Label>
                                <asp:Label runat="server" ID="PhoneNumber2" Visible="False" Text='<%#Eval("PhoneNumber2")%>'></asp:Label>
                            </td>
                            <td style="text-align: left; padding-left: 10px">
                                <asp:Label runat="server" ID="Branch" Text='<%#Eval("Branch")%>'></asp:Label>
                            </td>
                            <td>
                                <div style="text-align: center;">
                                    <asp:LinkButton runat="server" ToolTip="Edit" ID="editLinkButton" CommandName="Edit"
                                        CssClass="edit" OnCommand="EditLinkButton_OnCommand" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"STT") %>'></asp:LinkButton>
                                    <asp:LinkButton runat="server" ToolTip="Delete" ID="deleteButton" CommandName="Delete"
                                        CssClass="delete" OnClientClick="return confirmPost()" OnCommand="DeleteButton_OnCommand"
                                        CommandArgument='<%# DataBinder.Eval(Container.DataItem,"ContractorId") %>'></asp:LinkButton>
                                </div>
                            </td>
                        </tr>
                    </AlternatingItemTemplate>
                </asp:ListView>
                <div class="divPage">
                    <asp:DataPager ID="DataPager1" runat="server" PagedControlID="ViewAllContractListView"
                        PageSize="15" OnPreRender="DataPager1_OnPreRender">
                        <Fields>
                            <asp:NextPreviousPagerField />
                            <asp:NumericPagerField CurrentPageLabelCssClass="curent" />
                            <asp:NextPreviousPagerField />
                        </Fields>
                    </asp:DataPager>
                </div>
            </asp:Panel>
            <asp:Panel runat="server" ID="EditContractorPanel">
                <h1 class="title">
                    Edit Contractor</h1>
                <div class="divWrap">
                    <br />
                    <table style="width: 35%; height: 100%; margin: 0 auto">
                        <tr>
                            <td>
                                <asp:TextBox ID="ContractorIdTexBox" Visible="False" runat="server"></asp:TextBox>
                                FullName:
                            </td>
                            <td>
                                <asp:TextBox ID="FullNameTextBox" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                BirthDate:
                            </td>
                            <td>
                                <asp:TextBox ID="BirthDateTextBox" Enabled="False" BackColor="white" runat="server"></asp:TextBox>
                                <asp:ImageButton ID="Image" runat="server" CssClass="calender" ImageUrl="~/Images/calendar.png" />
                                <cc1:CalendarExtender ID="CalendarExtender1" CssClass="cal_Theme1" runat="server"
                                    TargetControlID="BirthDateTextBox" PopupButtonID="Image" PopupPosition="Right">
                                </cc1:CalendarExtender>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Gender:
                            </td>
                            <td>
                                <asp:DropDownList ID="GenderDropDownList" runat="server">
                                    <asp:ListItem>Male</asp:ListItem>
                                    <asp:ListItem>Female</asp:ListItem>
                                    <asp:ListItem>Other</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Email:
                            </td>
                            <td>
                                <asp:TextBox ID="EmailTextBox" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Address:
                            </td>
                            <td>
                                <asp:TextBox ID="AddressTextBox" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                PhoneNumber 1:
                            </td>
                            <td>
                                <asp:TextBox ID="PhoneNumberTextBox" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                PhoneNumber 2:
                            </td>
                            <td>
                                <asp:TextBox ID="PhoneNumbersTextBox" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Branch:
                            </td>
                            <td>
                                <asp:TextBox ID="BranchTextBox" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align: center">
                                <asp:Label ID="MessageLabel" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Button ID="Submit" runat="server" Text="Submit" OnClick="Submit_Click" />
                                <asp:Button ID="Back" runat="server" Text="Back" OnClick="Back_OnClick" />
                            </td>
                        </tr>
                    </table>
                </div>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
